/*                                    _
 *   ___ _ __ ___ _ __ ___   ___   __| |
 *  / __| '__/ __| '_ ` _ \ / _ \ / _` |
 *  \__ \ |  \__ \ | | | | | (_) | (_| |
 *  |___/_|  |___/_| |_| |_|\___/ \__,_|                                  
 *
 * |_  _ | _  _  _ _   _ _  _  _|   | _ 
 * | |(/_||_)(/_| _\  | | |(_)(_||_||(/_
 *        |                             
 */
 
#define FOR_EACH_CLIENT_COND(%1,%2)											\
	for(new %1 = CLIENT_VALID_FIRST; %1 <= CLIENT_VALID_LAST; %1++)			\
		if(%2)

#define FOR_EACH_HUMAN(%1)													\
	FOR_EACH_CLIENT_COND(%1, IsClientInGameHuman(%1))
	
#define FOR_EACH_ALIVE_HUMAN(%1)													\
	FOR_EACH_CLIENT_COND(%1, (IsClientInGameHuman(%1) && GetClientHealth(%1)>0 && IsPlayerAlive(%1)))
	
#define FOR_EACH_CLIENT(%1)													\
	FOR_EACH_CLIENT_COND(%1, IsClientInGame(%1))
	
#define FOR_EACH_ALIVE_CLIENT(%1)													\
	FOR_EACH_CLIENT_COND(%1, (IsClientInGame(%1) && GetClientHealth(%1)>0 && IsPlayerAlive(%1)))
		
#define FOR_EACH_HUMAN_ON_TEAM(%1,%2)										\
	FOR_EACH_HUMAN(%1)														\
		if(L4D_GetClientTeam(%1) == %2)
		
#define FOR_EACH_ALIVE_HUMAN_ON_TEAM(%1,%2)										\
	FOR_EACH_ALIVE_HUMAN(%1)														\
		if(L4D_GetClientTeam(%1) == %2)
	
#define FOR_EACH_CLIENT_ON_TEAM(%1,%2)										\
	FOR_EACH_CLIENT(%1)														\
		if(L4D_GetClientTeam(%1) == %2)
		
#define FOR_EACH_ALIVE_CLIENT_ON_TEAM(%1,%2)										\
	FOR_EACH_ALIVE_CLIENT(%1)														\
		if(L4D_GetClientTeam(%1) == %2)
	
#define FOR_EACH_SURVIVOR_HUMAN(%1)											\
	FOR_EACH_HUMAN_ON_TEAM(%1, L4DTeam_Survivors)
	
#define FOR_EACH_ALIVE_SURVIVOR_HUMAN(%1)											\
	FOR_EACH_ALIVE_HUMAN_ON_TEAM(%1, L4DTeam_Survivors)
	
#define FOR_EACH_SURVIVOR(%1)												\
	FOR_EACH_CLIENT_ON_TEAM(%1, L4DTeam_Survivors)
	
#define FOR_EACH_ALIVE_SURVIVOR(%1)												\
	FOR_EACH_ALIVE_CLIENT_ON_TEAM(%1, L4DTeam_Survivors)
	
#define FOR_EACH_INFECTED_HUMAN(%1)											\
	FOR_EACH_HUMAN_ON_TEAM(%1, L4DTeam_Infected)
	
#define FOR_EACH_ALIVE_INFECTED_HUMAN(%1)											\
	FOR_EACH_ALIVE_HUMAN_ON_TEAM(%1, L4DTeam_Infected)
	
#define FOR_EACH_INFECTED(%1)												\
	FOR_EACH_CLIENT_ON_TEAM(%1, L4DTeam_Infected)
	
#define FOR_EACH_ALIVE_INFECTED(%1)												\
	FOR_EACH_ALIVE_CLIENT_ON_TEAM(%1, L4DTeam_Infected)
	
#define FOR_EACH_SPECTATOR(%1)												\
	FOR_EACH_HUMAN_ON_TEAM(%1, L4DTeam_Spectate)
	
#define ACTIVATION_FLIP_OFF_TO_ON											\
	StringToInt(oldValue) == 0 && StringToInt(newValue) == 1
	
#define ACTIVATION_FLIP_ON_TO_OFF											\
	StringToInt(oldValue) == 1 && StringToInt(newValue) == 0